﻿using B.S.Sterilizationcenter.ErrorCode;
using B.S.Sterilizationcenter.Writer.API.Appliaction.Commends.Zmc.Apparatu;
using B.S.Sterilizationcenter.Writer.API.Appliaction.Commends.Zmc.Instrumentkit;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace B.S.Sterilizationcenter.Writer.API.Controllers.ZMC
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class InstrumentkitController : ControllerBase
    {
        private readonly IMediator mediator;

        public InstrumentkitController(IMediator mediator)
        {
            this.mediator = mediator;
        }

        /// <summary>
        /// 创建器械包数据
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        /// 
        [HttpPost]
        public async Task<ApiResult<int>> CreateInstrumentkit(CreateInstrumentkitCommends request, CancellationToken cancellationToken)
        {
            try
            {
                return await mediator.Send(request, cancellationToken);
            }
            catch (Exception)
            {

                throw;
            }
        }

        /// <summary>
        /// 更新器械包数据
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        /// 
        [HttpPut]                                                                      
        public async Task<ApiResult<int>> UpdataInstrumentkit(UpdataInstrumentkitCommends request, CancellationToken cancellationToken)
        {
            try
            {
                return await mediator.Send(request, cancellationToken);
            }
            catch (Exception)
            {

                throw;
            }
        }


        /// <summary>
        /// 删除器械包--逻辑删除
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        /// <exception cref="NotImplementedException"></exception>
        /// 
        [HttpPut]
        public async Task<ApiResult<int>> DelInstrumentkit(DelInstrumentkitCommends request, CancellationToken cancellationToken)
        {
            try
            {
                return await mediator.Send(request, cancellationToken);
            }
            catch (Exception)
            {

                throw;
            }
        }


    }
}
